package comet;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
@Entity
public class Enseignant implements Serializable {
	@Id
	private int indice;

	private String Nom;

	private String Prenom;

	private String Email;

	public Enseignant() {
	}
	public Enseignant(int indice, String nom, String prenom, String email) {

		this.indice = indice;

		this.nom = nom;

		this.prenom = prenom;

		this.email = email;
	}

	public int getIndice() {
		return this.indice;
	}
	public void setIndice(int indice) {
		this.indice = indice;
	}

	public String getNom() {
		return this.Nom;
	}
	public void setNom(String nom) {
		this.Nom = nom;
	}

	public String getPrenom() {
		return this.Prenom;
	}
	public void setPrenom(String prenom) {
		this.Prenom = prenom;
	}

	public String getEmail() {
		return this.Email;
	}
	public void setEmail(String email) {
		this.Email = email;
	}

	@ManyToMany(mappedBy = "enseignants")
	private Collection<Etudiant> etudiants = new ArrayList<Etudiant>();

	public void addEtudiant(Etudiant etudiant) {
		System.out.println("ALLAH");
		if (!getEtudiants().contains(etudiant)) {
			getEtudiants().add(etudiant);
		}
		if (!etudiant.getEnseignant().contains(this)) {
			etudiant.getEnseignant().add(this);
		}
	}

	public Collection<Etudiant> getEtudiants() {
		return etudiants;
	}

	public void setEtudiant(Collection<Etudiant> etudiants) {
		this.etudiants = etudiants;
	}

}
